3.13.10 \(\int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx\) [1210]

3.13.10.1 Optimal result
3.13.10.2 Mathematica [C] (verified)
3.13.10.3 Rubi [A] (verified)
3.13.10.4 Maple [A] (verified)
3.13.10.5 Fricas [A] (verification not implemented)
3.13.10.6 Sympy [C] (verification not implemented)
3.13.10.7 Maxima [A] (verification not implemented)
3.13.10.8 Giac [A] (verification not implemented)
3.13.10.9 Mupad [B] (verification not implemented)

3.13.10.1 Optimal result

Integrand size = 25, antiderivative size = 144 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{c^2+d^2}-\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}-\frac {(b c-a d)^3 \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right ) f}+\frac {b^2 (a+b \tan (e+f x))}{d f} \]

output
(a^3*c+3*a^2*b*d-3*a*b^2*c-b^3*d)*x/(c^2+d^2)-(-a^3*d+3*a^2*b*c+3*a*b^2*d- 
b^3*c)*ln(cos(f*x+e))/(c^2+d^2)/f-(-a*d+b*c)^3*ln(c+d*tan(f*x+e))/d^2/(c^2 
+d^2)/f+b^2*(a+b*tan(f*x+e))/d/f
 
3.13.10.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.80 (sec) , antiderivative size = 126, normalized size of antiderivative = 0.88 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {\frac {(a+i b)^3 \log (i-\tan (e+f x))}{i c-d}-\frac {(i a+b)^3 \log (i+\tan (e+f x))}{c-i d}+\frac {2 (-b c+a d)^3 \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )}+\frac {2 b^2 (a+b \tan (e+f x))}{d}}{2 f} \]

input
Integrate[(a + b*Tan[e + f*x])^3/(c + d*Tan[e + f*x]),x]
 
output
(((a + I*b)^3*Log[I - Tan[e + f*x]])/(I*c - d) - ((I*a + b)^3*Log[I + Tan[ 
e + f*x]])/(c - I*d) + (2*(-(b*c) + a*d)^3*Log[c + d*Tan[e + f*x]])/(d^2*( 
c^2 + d^2)) + (2*b^2*(a + b*Tan[e + f*x]))/d)/(2*f)
 
3.13.10.3 Rubi [A] (verified)

Time = 0.75 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.05, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.360, Rules used = {3042, 4049, 25, 3042, 4109, 3042, 3956, 4100, 16}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)}dx\)

\(\Big \downarrow \) 4049

\(\displaystyle \frac {\int -\frac {-d a^3+b^2 (b c-3 a d) \tan ^2(e+f x)+b^3 c-b \left (3 a^2-b^2\right ) d \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}+\frac {b^2 (a+b \tan (e+f x))}{d f}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {\int \frac {-d a^3+b^2 (b c-3 a d) \tan ^2(e+f x)+b^3 c-b \left (3 a^2-b^2\right ) d \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {\int \frac {-d a^3+b^2 (b c-3 a d) \tan (e+f x)^2+b^3 c-b \left (3 a^2-b^2\right ) d \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}\)

\(\Big \downarrow \) 4109

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {-\frac {d \left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {(b c-a d)^3 \int \frac {\tan ^2(e+f x)+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {d x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{c^2+d^2}}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {-\frac {d \left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {(b c-a d)^3 \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {d x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{c^2+d^2}}{d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {\frac {(b c-a d)^3 \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d \left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}-\frac {d x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{c^2+d^2}}{d}\)

\(\Big \downarrow \) 4100

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {\frac {(b c-a d)^3 \int \frac {1}{c+d \tan (e+f x)}d(d \tan (e+f x))}{d f \left (c^2+d^2\right )}+\frac {d \left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}-\frac {d x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{c^2+d^2}}{d}\)

\(\Big \downarrow \) 16

\(\displaystyle \frac {b^2 (a+b \tan (e+f x))}{d f}-\frac {\frac {d \left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}-\frac {d x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{c^2+d^2}+\frac {(b c-a d)^3 \log (c+d \tan (e+f x))}{d f \left (c^2+d^2\right )}}{d}\)

input
Int[(a + b*Tan[e + f*x])^3/(c + d*Tan[e + f*x]),x]
 
output
-((-((d*(a^3*c - 3*a*b^2*c + 3*a^2*b*d - b^3*d)*x)/(c^2 + d^2)) + (d*(3*a^ 
2*b*c - b^3*c - a^3*d + 3*a*b^2*d)*Log[Cos[e + f*x]])/((c^2 + d^2)*f) + (( 
b*c - a*d)^3*Log[c + d*Tan[e + f*x]])/(d*(c^2 + d^2)*f))/d) + (b^2*(a + b* 
Tan[e + f*x]))/(d*f)
 

3.13.10.3.1 Defintions of rubi rules used

rule 16
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + 
b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
 

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4049
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c 
+ d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Simp[1/(d*(m + n - 1)) 
 Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n 
- 1) - b^2*(b*c*(m - 2) + a*d*(1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[ 
e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2, x], x], 
x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2 
, 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || I 
ntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])) 
)
 

rule 4100
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f)   Subst[Int[(a + x)^m, x], x, b* 
Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
 

rule 4109
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 
)/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a 
*C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[( 
1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( 
a^2 + b^2)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & 
& NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C 
, 0]
 
3.13.10.4 Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 164, normalized size of antiderivative = 1.14

method result size
derivativedivides \(\frac {\frac {b^{3} \tan \left (f x +e \right )}{d}+\frac {\left (a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}+\frac {\frac {\left (-a^{3} d +3 a^{2} b c +3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(164\)
default \(\frac {\frac {b^{3} \tan \left (f x +e \right )}{d}+\frac {\left (a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}+\frac {\frac {\left (-a^{3} d +3 a^{2} b c +3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(164\)
norman \(\frac {\left (a^{3} c +3 a^{2} b d -3 a \,b^{2} c -b^{3} d \right ) x}{c^{2}+d^{2}}+\frac {b^{3} \tan \left (f x +e \right )}{d f}+\frac {\left (a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right ) d^{2} f}-\frac {\left (a^{3} d -3 a^{2} b c -3 a \,b^{2} d +b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (c^{2}+d^{2}\right )}\) \(168\)
parallelrisch \(-\frac {-2 a^{3} c \,d^{2} f x -6 a^{2} b \,d^{3} f x +6 a \,b^{2} c \,d^{2} f x +2 b^{3} d^{3} f x +\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{3} d^{3}-3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b c \,d^{2}-3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a \,b^{2} d^{3}+\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{3} c \,d^{2}-2 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{3} d^{3}+6 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{2} b c \,d^{2}-6 \ln \left (c +d \tan \left (f x +e \right )\right ) a \,b^{2} c^{2} d +2 \ln \left (c +d \tan \left (f x +e \right )\right ) b^{3} c^{3}-2 b^{3} c^{2} d \tan \left (f x +e \right )-2 b^{3} d^{3} \tan \left (f x +e \right )}{2 \left (c^{2}+d^{2}\right ) d^{2} f}\) \(250\)
risch \(\frac {6 i b^{2} a x}{d}+\frac {6 i a^{2} b c e}{\left (c^{2}+d^{2}\right ) f}-\frac {a^{3} x}{i d -c}+\frac {3 x a \,b^{2}}{i d -c}-\frac {2 i d \,a^{3} e}{\left (c^{2}+d^{2}\right ) f}-\frac {6 i a \,b^{2} c^{2} x}{\left (c^{2}+d^{2}\right ) d}+\frac {6 i a^{2} b c x}{c^{2}+d^{2}}-\frac {2 i b^{3} c x}{d^{2}}-\frac {2 i b^{3} c e}{d^{2} f}-\frac {2 i d \,a^{3} x}{c^{2}+d^{2}}+\frac {3 i x \,a^{2} b}{i d -c}+\frac {2 i b^{3} c^{3} e}{\left (c^{2}+d^{2}\right ) d^{2} f}+\frac {6 i b^{2} a e}{d f}-\frac {i x \,b^{3}}{i d -c}+\frac {2 i b^{3} c^{3} x}{\left (c^{2}+d^{2}\right ) d^{2}}+\frac {2 i b^{3}}{f d \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}-\frac {6 i a \,b^{2} c^{2} e}{\left (c^{2}+d^{2}\right ) d f}-\frac {3 b^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a}{d f}+\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{d^{2} f}+\frac {d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{3}}{\left (c^{2}+d^{2}\right ) f}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{2} b c}{\left (c^{2}+d^{2}\right ) f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a \,b^{2} c^{2}}{\left (c^{2}+d^{2}\right ) d f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) b^{3} c^{3}}{\left (c^{2}+d^{2}\right ) d^{2} f}\) \(563\)

input
int((a+b*tan(f*x+e))^3/(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)
 
output
1/f*(b^3/d*tan(f*x+e)+1/d^2*(a^3*d^3-3*a^2*b*c*d^2+3*a*b^2*c^2*d-b^3*c^3)/ 
(c^2+d^2)*ln(c+d*tan(f*x+e))+1/(c^2+d^2)*(1/2*(-a^3*d+3*a^2*b*c+3*a*b^2*d- 
b^3*c)*ln(1+tan(f*x+e)^2)+(a^3*c+3*a^2*b*d-3*a*b^2*c-b^3*d)*arctan(tan(f*x 
+e))))
 
3.13.10.5 Fricas [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 206, normalized size of antiderivative = 1.43 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c d^{2} + {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} f x - {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + b^{3} c d^{2} - 3 \, a b^{2} d^{3}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (b^{3} c^{2} d + b^{3} d^{3}\right )} \tan \left (f x + e\right )}{2 \, {\left (c^{2} d^{2} + d^{4}\right )} f} \]

input
integrate((a+b*tan(f*x+e))^3/(c+d*tan(f*x+e)),x, algorithm="fricas")
 
output
1/2*(2*((a^3 - 3*a*b^2)*c*d^2 + (3*a^2*b - b^3)*d^3)*f*x - (b^3*c^3 - 3*a* 
b^2*c^2*d + 3*a^2*b*c*d^2 - a^3*d^3)*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f 
*x + e) + c^2)/(tan(f*x + e)^2 + 1)) + (b^3*c^3 - 3*a*b^2*c^2*d + b^3*c*d^ 
2 - 3*a*b^2*d^3)*log(1/(tan(f*x + e)^2 + 1)) + 2*(b^3*c^2*d + b^3*d^3)*tan 
(f*x + e))/((c^2*d^2 + d^4)*f)
 
3.13.10.6 Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.78 (sec) , antiderivative size = 1712, normalized size of antiderivative = 11.89 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(f*x+e))**3/(c+d*tan(f*x+e)),x)
 
output
Piecewise((zoo*x*(a + b*tan(e))**3/tan(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)) 
, ((a**3*x + 3*a**2*b*log(tan(e + f*x)**2 + 1)/(2*f) - 3*a*b**2*x + 3*a*b* 
*2*tan(e + f*x)/f - b**3*log(tan(e + f*x)**2 + 1)/(2*f) + b**3*tan(e + f*x 
)**2/(2*f))/c, Eq(d, 0)), (I*a**3*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2 
*I*d*f) + a**3*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*a**3/(2*d*f*tan(e + 
f*x) - 2*I*d*f) + 3*a**2*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) 
 - 3*I*a**2*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) - 3*a**2*b/(2*d*f*tan(e + 
 f*x) - 2*I*d*f) + 3*I*a*b**2*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d 
*f) + 3*a*b**2*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + 3*a*b**2*log(tan(e + f 
*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - 3*I*a*b**2*log(t 
an(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) - 3*I*a*b**2/(2*d*f*tan 
(e + f*x) - 2*I*d*f) - 3*b**3*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d 
*f) + 3*I*b**3*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*b**3*log(tan(e + f*x 
)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + b**3*log(tan(e + f 
*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) + 2*b**3*tan(e + f*x)**2/(2*d*f 
*tan(e + f*x) - 2*I*d*f) + 3*b**3/(2*d*f*tan(e + f*x) - 2*I*d*f), Eq(c, -I 
*d)), (-I*a**3*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + a**3*f*x/ 
(2*d*f*tan(e + f*x) + 2*I*d*f) - I*a**3/(2*d*f*tan(e + f*x) + 2*I*d*f) + 3 
*a**2*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + 3*I*a**2*b*f*x/( 
2*d*f*tan(e + f*x) + 2*I*d*f) - 3*a**2*b/(2*d*f*tan(e + f*x) + 2*I*d*f)...
 
3.13.10.7 Maxima [A] (verification not implemented)

Time = 0.37 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.21 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {\frac {2 \, b^{3} \tan \left (f x + e\right )}{d} + \frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} - \frac {2 \, {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d^{2} + d^{4}} + \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c - {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \]

input
integrate((a+b*tan(f*x+e))^3/(c+d*tan(f*x+e)),x, algorithm="maxima")
 
output
1/2*(2*b^3*tan(f*x + e)/d + 2*((a^3 - 3*a*b^2)*c + (3*a^2*b - b^3)*d)*(f*x 
 + e)/(c^2 + d^2) - 2*(b^3*c^3 - 3*a*b^2*c^2*d + 3*a^2*b*c*d^2 - a^3*d^3)* 
log(d*tan(f*x + e) + c)/(c^2*d^2 + d^4) + ((3*a^2*b - b^3)*c - (a^3 - 3*a* 
b^2)*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2))/f
 
3.13.10.8 Giac [A] (verification not implemented)

Time = 0.64 (sec) , antiderivative size = 173, normalized size of antiderivative = 1.20 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {\frac {2 \, b^{3} \tan \left (f x + e\right )}{d} + \frac {2 \, {\left (a^{3} c - 3 \, a b^{2} c + 3 \, a^{2} b d - b^{3} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {{\left (3 \, a^{2} b c - b^{3} c - a^{3} d + 3 \, a b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} - \frac {2 \, {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d^{2} + d^{4}}}{2 \, f} \]

input
integrate((a+b*tan(f*x+e))^3/(c+d*tan(f*x+e)),x, algorithm="giac")
 
output
1/2*(2*b^3*tan(f*x + e)/d + 2*(a^3*c - 3*a*b^2*c + 3*a^2*b*d - b^3*d)*(f*x 
 + e)/(c^2 + d^2) + (3*a^2*b*c - b^3*c - a^3*d + 3*a*b^2*d)*log(tan(f*x + 
e)^2 + 1)/(c^2 + d^2) - 2*(b^3*c^3 - 3*a*b^2*c^2*d + 3*a^2*b*c*d^2 - a^3*d 
^3)*log(abs(d*tan(f*x + e) + c))/(c^2*d^2 + d^4))/f
 
3.13.10.9 Mupad [B] (verification not implemented)

Time = 6.53 (sec) , antiderivative size = 177, normalized size of antiderivative = 1.23 \[ \int \frac {(a+b \tan (e+f x))^3}{c+d \tan (e+f x)} \, dx=\frac {b^3\,\mathrm {tan}\left (e+f\,x\right )}{d\,f}+\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a^3\,d^3-3\,a^2\,b\,c\,d^2+3\,a\,b^2\,c^2\,d-b^3\,c^3\right )}{f\,\left (c^2\,d^2+d^4\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-a^3\,1{}\mathrm {i}+3\,a^2\,b+a\,b^2\,3{}\mathrm {i}-b^3\right )}{2\,f\,\left (c+d\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-a^3+a^2\,b\,3{}\mathrm {i}+3\,a\,b^2-b^3\,1{}\mathrm {i}\right )}{2\,f\,\left (d+c\,1{}\mathrm {i}\right )} \]

input
int((a + b*tan(e + f*x))^3/(c + d*tan(e + f*x)),x)
 
output
(b^3*tan(e + f*x))/(d*f) + (log(c + d*tan(e + f*x))*(a^3*d^3 - b^3*c^3 + 3 
*a*b^2*c^2*d - 3*a^2*b*c*d^2))/(f*(d^4 + c^2*d^2)) + (log(tan(e + f*x) - 1 
i)*(a*b^2*3i + 3*a^2*b - a^3*1i - b^3))/(2*f*(c + d*1i)) + (log(tan(e + f* 
x) + 1i)*(3*a*b^2 + a^2*b*3i - a^3 - b^3*1i))/(2*f*(c*1i + d))